﻿Imports System.IO
Public Class Form1
    '// This Project Free for U plz give me a credit if u share thanks

    Public Shared Function getGamePath() 'Get the Game Path
        Dim Path As String = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III", "InstallPath", Nothing)
        Return Path
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            If Process.GetProcessesByName("war3").Length > 0 Then 'check process w3
                Dim BaseGame As Int32
                For Each PM As ProcessModule In Process.GetProcessesByName("war3")(0).Modules
                    If "Game.dll" = PM.ModuleName Then
                        BaseGame = PM.BaseAddress
                        Dim sHexValue As String
                        ' From Dec to Hex:
                        sHexValue = "&H" & Hex$(BaseGame)
                        '============================= Original Offset Chainy ====================
                        '               <<<<<< Support On Cybergames 1.23.1 >>>>>>>>
                        ' Clickable(Units)
                        WriteMemoryASM("war3", (sHexValue) + &H2851BE, New Byte(1) {&HEB, &H1D})
                        'Main Unit reveal
                        WriteMemoryASM("war3", (sHexValue) + &H3A159F, New Byte(3) {&HEB, &H30, &H90, &H90})
                        'Invisible
                        WriteMemoryASM("war3", (sHexValue) + &H399A9E, New Byte(1) {&HEB, &H21})
                    End If
                Next
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Process.GetProcessesByName("Cybergames").Length > 0 And Process.GetProcessesByName("war3").Length > 0 Then
            Button1.Enabled = True
        Else
            Button1.Enabled = False
        End If
        If Process.GetProcessesByName("Cybergames").Length > 0 Then
            Label2.Text = "Online"
        Else
            Label2.Text = "Null"
        End If
        If Process.GetProcessesByName("War3").Length > 0 Then
            Label3.Text = "Online"
        Else
            Label3.Text = "Null"
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' plugin
        Try

            File.WriteAllBytes(getGamePath() & "\cam.mix", My.Resources.Camera_Hack)
            File.WriteAllBytes(getGamePath() & "\mana.mix", My.Resources.ManaBars)
            File.WriteAllBytes(getGamePath() & "\rune.mix", My.Resources.RuneGemRohanSignal)
            File.WriteAllBytes(getGamePath() & "\war3dmg.mix", My.Resources.w3dmg)
            File.WriteAllBytes(getGamePath() & "\safeclick.mix", My.Resources.safeclick)
            MsgBox("Complete")
        Catch
            MsgBox("Error install")
        End Try

    End Sub
End Class
